import request from '@/utils/request'
import qs from 'qs'
// 部门管理
export function updateCompanyName(object) {
  return request({
    url: 'vue/department/updateCompanyName',
    method: 'post',
    data: object
  })
}
export function addDepartmentNode(object) {
  return request({
    url: 'vue/department/add',
    method: 'post',
    data: object
  })
}
export function updateDepartment(object) {
  return request({
    url: 'department/update',
    method: 'post',
    data: object
  })
}
export function initDepartment(object) {
  return request({
    url: 'department/init',
    method: 'post',
    params: object
  })
}
export function deleteDepartmentNode(object) {
  return request({
    url: 'vue/department/delete',
    method: 'post',
    data: object
  })
}
// 获取中国地区代码
export function getArea(object) {
  return request({
    url: 'vue/area/load',
    method: 'post',
    data: object
  })
}
// 客户管理
export function addClientCompany(object) {
  return request({
    url: 'vue/company/add',
    method: 'post',
    data: object
  })
}
export function editClientCompany(object) {
  return request({
    url: 'vue/company/update',
    method: 'post',
    data: object
  })
}
export function deleteClientCompany(object) {
  return request({
    url: 'vue/company/delete',
    method: 'post',
    data: object
  })
}
export function addClientPerson(object) {
  return request({
    url: 'vue/person/add',
    method: 'post',
    data: object
  })
}
export function editClientPerson(object) {
  return request({
    url: 'vue/person/update',
    method: 'post',
    data: object
  })
}
export function deleteClientPerson(object) {
  return request({
    url: 'vue/person/delete',
    method: 'post',
    data: object
  })
}
// 区域管理
export function getRegionTree() {
  return request({
    url: 'vue/region/loadTree',
    method: 'get'
  })
}
export function getRegionInfo(object) {
  return request({
    url: 'vue/region/load',
    method: 'post',
    data: object
  })
}
export function addRegion(object) {
  return request({
    url: 'vue/region/add',
    method: 'post',
    data: object
  })
}
export function editRegion(object) {
  return request({
    url: 'vue/region/update',
    method: 'post',
    data: object
  })
}
export function deleteRegion(object) {
  return request({
    url: 'vue/region/delete',
    method: 'post',
    data: object
  })
}
// 获取环境(温湿度气压)数据
export function getEnvironmentData(object) {
  return request({
    url: '/region/getEnvironmentData',
    method: 'post',
    params: object
  })
}

// 日志管理
export function getLoginLog(object) {
  return request({
    url: 'vue/loginLog/load',
    method: 'post',
    data: object
  })
}
export function getLogOperateType() {
  return request({
    url: 'log/loadLogTypeComboOption',
    method: 'post'
  })
}
// 角色管理
export function getRole(object) {
  return request({
    url: '/role/loadRolePage',
    method: 'post',
    data: object
  })
}
export function loadRoleGrid(object) {
  return request({
    url: '/role/loadRoleGrid',
    method: 'post',
    data: object
  })
}

export function deleteRole(object) {
  return request({
    url: 'role/delete',
    method: 'get',
    params: object
  })
}
export function addRole(object) {
  return request({
    url: 'role/add',
    method: 'post',
    data: object
  })
}
export function updateRole(object) {
  return request({
    url: 'role/update',
    method: 'post',
    data: object
  })
}
// 启用\停用角色
export function enableRole(object) {
  return request({
    url: '/role/enableRole',
    method: 'get',
    params: object
  })
}
export function getUserRole(roleId) {
  return request({
    url: 'role/findById?roleId=' + roleId,
    method: 'get'
  })
}
// 管理用户-批量添加用户
export function addRoleUsers(object) {
  return request({
    url: '/role/addRoleUsers',
    method: 'post',
    data: object
  })
}
// 管理用户-批量移除用户
export function removeRoleUsers(object) {
  return request({
    url: '/role/removeRoleUsers',
    method: 'post',
    data: object
  })
}
/** 菜单管理  */
export function getRoleRightIds(roleId) {
  return request({
    url: 'right/loadRoleRightIds?roleId=' + roleId,
    method: 'get'
  })
}
export function getRightTree() {
  return request({
    url: 'right/loadTree',
    method: 'get'
  })
}
// 设置功能权限-加载权限树全部节点
export function loadRightTree() {
  return request({
    url: '/role/loadRightTree',
    method: 'get'
  })
}
export function loadMenuTree() {
  return request({
    url: 'right/loadMenuTree',
    method: 'get'
  })
}

// 设置功能权限-获取角色拥有的权限
export function loadRoleRightIds(params) {
  return request({
    url: '/right/loadRoleRightIds',
    method: 'get',
    params
  })
}
// 设置功能权限-保存权限配置
export function setRoleRights(data) {
  return request({
    url: '/role/setRoleRights',
    method: 'post',
    data
  })
}
// 管理用户-加载角色分配的用户列表
export function loadUserGridInRole(data) {
  return request({
    url: '/role/loadUserGridInRole',
    method: 'post',
    data
  })
}
// 管理用户-加载不属于该角色的用户列表
export function loadUserGridOutRole(data) {
  return request({
    url: '/role/loadUserGridOutRole',
    method: 'post',
    data
  })
}
// 加载权限树形表格
export function loadRightGird(data) {
  return request({
    url: '/right/loadRightGird',
    method: 'post',
    data
  })
}
export function addRight(data) {
  return request({
    url: '/right/save',
    method: 'post',
    data
  })
}
export function updateRight(data) {
  return request({
    url: '/right/update',
    method: 'post',
    data
  })
}
// 加载权限标识下拉框
export function loadRightCodeOptions() {
  return request({
    url: '/right/loadRightCodeOptions',
    method: 'get'
  })
}
// 启用/停用权限
export function disableRight(params) {
  return request({
    url: '/right/disableRight',
    method: 'get',
    params
  })
}
// 删除权限
export function deleteRight(params) {
  return request({
    url: '/right/delete',
    method: 'get',
    params
  })
}
export function getRoleOption() {
  return request({
    url: 'vue/role/loadRoleComboOption',
    method: 'get'
  })
}
// 用户管理
export function getUser(object) {
  return request({
    url: 'vue/user/load',
    method: 'post',
    data: object
  })
}
export function addUser(object) {
  return request({
    url: 'vue/user/add',
    method: 'post',
    data: object
  })
}
export function updateUser(object) {
  return request({
    url: 'vue/user/update',
    method: 'post',
    data: object
  })
}
export function deleteUser(object) {
  return request({
    url: 'vue/user/delete',
    method: 'post',
    data: object
  })
}
export function sendUserPasswordEmail(object) {
  return request({
    url: 'vue/user/send',
    method: 'post',
    data: object
  })
}
export function getUserPassword(object) {
  return request({
    url: 'vue/user/getPassword',
    method: 'post',
    data: object
  })
}
// 管理角色-获取用户拥有的角色ID
export function getRoleIdsByUserId(params) {
  return request({
    url: '/user/getRoleIdsByUserId',
    method: 'get',
    params
  })
}
// 设置角色-批量分配角色
export function setUserRoles(data) {
  return request({
    url: '/user/setUserRoles',
    method: 'post',
    data
  })
}
export function getDeptOptions() {
  return request({
    url: 'vue/department/loadDepartmentTree',
    method: 'get'
  })
}

// 厂家管理
export function getSupplier(object) {
  return request({
    url: 'vue/supplier/load',
    method: 'post',
    data: object
  })
}
export function getSupplierExport(object) {
  return request({
    url: 'vue/supplier/export',
    method: 'post',
    data: object
  })
}
export function getSupplierExportAll(object) {
  return request({
    url: 'vue/supplier/exportAll',
    method: 'post',
    data: object
  })
}
export function addSupplier(object) {
  return request({
    url: 'vue/supplier/add',
    method: 'post',
    data: object
  })
}
export function updateSupplier(object) {
  return request({
    url: 'vue/supplier/update',
    method: 'post',
    data: object
  })
}
export function deleteSupplier(object) {
  return request({
    url: 'vue/supplier/delete',
    method: 'post',
    data: object
  })
}
export function getSupplierFile(object) {
  return request({
    url: 'vue/supplier/loadFile',
    method: 'post',
    data: object
  })
}
export function resetPassword(data) {
  return request({
    url: 'user/resetPassword',
    method: 'post',
    data: data
  })
}
export function getVersionsRecordData(data) {
  return request({
    url: 'versionsRecord/getVersionsRecordData',
    method: 'post',
    data: data
  })
}

// 上传文件
export function uploadFile(data) {
  return request({
    url: '/files/upload',
    method: 'post',
    data: data
  })
}
export function uploadFolder(data) {
  return request({
    url: 'files/uploadFolder',
    method: 'post',
    data: data
  })
}

// 设备运行状态记录表格
export function loadDeviceStateRecord(data) {
  return request({
    url: '/deviceStateRecord/loadTable',
    method: 'post',
    data
  })
}
// 获取监控台运行状态记录数据
export function getMonitoringDeskData(data) {
  return request({
    url: '/deviceStateRecord/getMonitoringDeskData',
    method: 'post',
    data
  })
}
// 获取监控台设备操作日志
export function getMonitoringDeskDeviceOperateLog(data) {
  return request({
    url: '/log/getMonitoringDeskDeviceOperateLog',
    method: 'post',
    data
  })
}
// 获取监控台报警数据
export function getMonitoringAlarmData(data) {
  return request({
    url: '/alarm/getMonitoringDeskData',
    method: 'post',
    data
  })
}
